package com.lzw.bluetoothpractice.network.api;

import com.alibaba.fastjson.JSONObject;
import com.lzw.bluetoothpractice.Models.Comment;
import com.lzw.bluetoothpractice.Models.Device;
import com.lzw.bluetoothpractice.Models.Kneel;
import com.lzw.bluetoothpractice.Models.Temperature;
import com.lzw.bluetoothpractice.Models.UserDoctor;
import com.lzw.bluetoothpractice.Models.UserDoctorMessage;
import com.lzw.bluetoothpractice.Models.Walk;
import com.lzw.bluetoothpractice.bean.LoginBody;
import com.lzw.bluetoothpractice.bean.UserDoctorMessageBean;

import java.io.File;
import java.util.List;
import java.util.Map;

import okhttp3.FormBody;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.PartMap;
import retrofit2.http.Query;
import retrofit2.http.Streaming;
import retrofit2.http.Url;
import rx.Observable;

/**
 * Created by sushuai on 2016/3/25.
 */
public interface RequestApi {
    /**
     * 文件下载
     *
     * @return
     */
    @Streaming
    @GET
    Observable<ResponseBody> downLoaderFile(@Url String url);

    //图片上传
    @POST()
    Observable<JSONObject> uploadImage(@Url String url, @Body File file);

    @GET("app/conf/1.txt")
    Observable<JSONObject> initAppUrl();

    //版本检查
    @GET("/api/Other/AppConfiguration")
    Observable<JSONObject> versionChecking(@Query("platform") String platform_, @Query("version") String version_, @Header("platform") String platform, @Header("version") String version,
                                           @Header("companyID") String companyID, @Header("authorization") String authorization
            , @Header("X-Date") String gmtStr, @Header("Content-md5") String contentMD5, @Header("proxy-authorization") String hmacCode
    );

    //验证token是否失效
    @GET("/api/ShopNew/WebviewConfigure")
    Observable<JSONObject> initWebViewConfigure(@Header("platform") String platform, @Header("version") String version,
                                                @Header("companyID") String companyID, @Header("authorization") String authorization
            , @Header("X-Date") String gmtStr, @Header("Content-md5") String contentMD5, @Header("proxy-authorization") String hmacCode
    );

    //验证token是否失效
    @GET("/api/User/CheckTokenIsEffective")
    Observable<JSONObject> checkTokenIsEffective(@Header("platform") String platform, @Header("version") String version
            , @Header("authorization") String authorization
            , @Header("X-Date") String gmtStr, @Header("Content-md5") String contentMD5, @Header("proxy-authorization") String hmacCode
    );


    //账号密码登录
    @POST("/prod-api/login")
    Observable<JSONObject> accountLogin(@Body LoginBody loginBody, @Header("platform") String platform, @Header("version") String version,
                                        @Header("authorization") String authorization
            , @Header("X-Date") String gmtStr, @Header("Content-md5") String contentMD5, @Header("proxy-authorization") String hmacCode
    );
    //注册
    @POST("/android/user/register")
    Observable<JSONObject> accountRegister(@Body JSONObject map, @Header("platform") String platform, @Header("version") String version,
                                        @Header("authorization") String authorization
            , @Header("X-Date") String gmtStr, @Header("Content-md5") String contentMD5, @Header("proxy-authorization") String hmacCode
    );

    //获取二维码，uuid
    @GET("/prod-api/captchaImage")
    Observable<JSONObject> getcode(@Header("platform") String platform, @Header("version") String version,
                                           @Header("authorization") String authorization
            , @Header("X-Date") String gmtStr, @Header("Content-md5") String contentMD5, @Header("proxy-authorization") String hmacCode
    );

    //获取二维码，uuid
    @GET("/prod-api/captchaImage")
    Observable<JSONObject> PostAngel(@Header("platform") String platform, @Header("version") String version,
                                   @Header("authorization") String authorization
            , @Header("X-Date") String gmtStr, @Header("Content-md5") String contentMD5, @Header("proxy-authorization") String hmacCode
    );
    //获取推荐医生
    @GET("/prod-api/android/user/recommendDoctor")
    Observable<JSONObject> getDoctor(@Header("platform") String platform, @Header("version") String version,@Header("authorization") String authorization
            , @Header("X-Date") String gmtStr, @Header("Content-md5") String contentMD5, @Header("proxy-authorization") String hmacCode
    );
    //根据名称查找医生
    @POST("/prod-api/android/user/researchByUserName")
    Observable<JSONObject> getDoctorByName(@Body JSONObject user,@Header("platform") String platform, @Header("version") String version,@Header("authorization") String authorization
            , @Header("X-Date") String gmtStr, @Header("Content-md5") String contentMD5, @Header("proxy-authorization") String hmacCode
    );

    //绑定医生
    @POST("/prod-api/android/doctor/addUserDoctor")
    Observable<JSONObject> addUserDoctor(@Body UserDoctor userDoctor, @Header("platform") String platform, @Header("version") String version, @Header("authorization") String authorization
            , @Header("X-Date") String gmtStr, @Header("Content-md5") String contentMD5, @Header("proxy-authorization") String hmacCode
    );
    //获取推荐医院
    @GET("/prod-api/android/hospital/recommendHospital")
    Observable<JSONObject> recommendHospital(@Header("platform") String platform, @Header("version") String version,@Header("authorization") String authorization
            , @Header("X-Date") String gmtStr, @Header("Content-md5") String contentMD5, @Header("proxy-authorization") String hmacCode
    );
    //获取资讯消息
    @GET("/prod-api/android/message/list")
    Observable<JSONObject> getMessageList(@Header("platform") String platform, @Header("version") String version,
                                     @Header("authorization") String authorization
            , @Header("X-Date") String gmtStr, @Header("Content-md5") String contentMD5, @Header("proxy-authorization") String hmacCode
    );
    //添加设备信息
    @POST("/prod-api/android/device/add")
    Observable<JSONObject> addDevice(@Body Device device,@Header("permission") String permission, @Header("platform") String platform, @Header("version") String version, @Header("authorization") String authorization
            , @Header("X-Date") String gmtStr, @Header("Content-md5") String contentMD5, @Header("proxy-authorization") String hmacCode
    );
    //获取用户信息
    @GET("/prod-api/getInfo")
    Observable<JSONObject> getUser(@Header("platform") String platform, @Header("version") String version,@Header("authorization") String authorization
            , @Header("X-Date") String gmtStr, @Header("Content-md5") String contentMD5, @Header("proxy-authorization") String hmacCode
    );
    //获取用户信息
    @GET("/prod-api/system/user/getInfoForAndroid")
    Observable<JSONObject> getUserById(@Query("userId") Long userId,@Header("platform") String platform, @Header("version") String version,@Header("authorization") String authorization
            , @Header("X-Date") String gmtStr, @Header("Content-md5") String contentMD5, @Header("proxy-authorization") String hmacCode
    );

    //获取资讯消息
    @GET("/prod-api/android/message/getInfoById")
    Observable<JSONObject> getMessageDetail(@Query("messageId") Long messageId,@Header("platform") String platform, @Header("version") String version,
                                          @Header("authorization") String authorization
            , @Header("X-Date") String gmtStr, @Header("Content-md5") String contentMD5, @Header("proxy-authorization") String hmacCode
    );
    //获取资讯消息
    @GET("/prod-api/android/hospital/researchById")
    Observable<JSONObject> getHosptialDetail(@Query("hospitalId") Long messageId,@Header("platform") String platform, @Header("version") String version,
                                            @Header("authorization") String authorization
            , @Header("X-Date") String gmtStr, @Header("Content-md5") String contentMD5, @Header("proxy-authorization") String hmacCode
    );

    //添加行走
    @POST("/prod-api/android/walk/add")
    Observable<JSONObject> addWalk(@Body Walk walk, @Header("permission") String permission, @Header("platform") String platform, @Header("version") String version, @Header("authorization") String authorization
            , @Header("X-Date") String gmtStr, @Header("Content-md5") String contentMD5, @Header("proxy-authorization") String hmacCode
    );

    //添加温度
    @POST("/prod-api/android/temperature/addTemperature")
    Observable<JSONObject> addTemp(@Body Temperature temperature, @Header("permission") String permission, @Header("platform") String platform, @Header("version") String version, @Header("authorization") String authorization
            , @Header("X-Date") String gmtStr, @Header("Content-md5") String contentMD5, @Header("proxy-authorization") String hmacCode
    );
    //获取设备
    @GET("/prod-api/android/device/selectDeviceByUserId")
    Observable<JSONObject> selectDeviceByUserId(@Query("user_id") Long userId,@Header("platform") String platform, @Header("version") String version,
                                            @Header("authorization") String authorization
            , @Header("X-Date") String gmtStr, @Header("Content-md5") String contentMD5, @Header("proxy-authorization") String hmacCode
    );

    //添加屈膝度
    @POST("/prod-api/android/kneel/addKneel")
    Observable<JSONObject> addKneel(@Body Kneel kneel, @Header("permission") String permission, @Header("platform") String platform, @Header("version") String version, @Header("authorization") String authorization
            , @Header("X-Date") String gmtStr, @Header("Content-md5") String contentMD5, @Header("proxy-authorization") String hmacCode
    );

    //查找屈膝度
    @GET("/prod-api/android/kneel/researchByUserId")
    Observable<JSONObject> getKneel(@Query("userId")Long userId, @Header("platform") String platform, @Header("version") String version, @Header("authorization") String authorization
            , @Header("X-Date") String gmtStr, @Header("Content-md5") String contentMD5, @Header("proxy-authorization") String hmacCode
    );

    //查找温度
    @GET("/prod-api/android/temperature/researchByUserId")
    Observable<JSONObject> getTemperature(@Query("userId")Long userId, @Header("platform") String platform, @Header("version") String version, @Header("authorization") String authorization
            , @Header("X-Date") String gmtStr, @Header("Content-md5") String contentMD5, @Header("proxy-authorization") String hmacCode
    );


    //获取推荐医院
    @GET("/prod-api/android/doctor/selectDoctorsByUserId")
    Observable<JSONObject> getMyDoctor(@Query("usdUserId")Long usdUserId ,@Header("platform") String platform, @Header("version") String version,@Header("authorization") String authorization
            , @Header("X-Date") String gmtStr, @Header("Content-md5") String contentMD5, @Header("proxy-authorization") String hmacCode
    );

    //获取论坛消息
    @GET("/prod-api/android/forum/listForAndroid")
    Observable<JSONObject> forumList(@Header("platform") String platform, @Header("version") String version,
                                                @Header("authorization") String authorization
            , @Header("X-Date") String gmtStr, @Header("Content-md5") String contentMD5, @Header("proxy-authorization") String hmacCode
    );

    //获取我的论坛消息
    @GET("/prod-api/android/forum/forumListByUserId")
    Observable<JSONObject> forumListByUserId(@Query("userId")Long userId,@Header("platform") String platform, @Header("version") String version,
                                     @Header("authorization") String authorization
            , @Header("X-Date") String gmtStr, @Header("Content-md5") String contentMD5, @Header("proxy-authorization") String hmacCode
    );

    //获取医生留言消息
    @GET("/prod-api/android/UserDoctorMessage/researchDetail")
    Observable<JSONObject> researchDetail(@Query("mesUserId")Long mesUserId,@Query("mesDoctorId")Long mesDoctorId, @Header("platform") String platform, @Header("version") String version,
                                          @Header("authorization") String authorization
            , @Header("X-Date") String gmtStr, @Header("Content-md5") String contentMD5, @Header("proxy-authorization") String hmacCode
    );

    //添加留言消息
    @POST("/prod-api/android/UserDoctorMessage/addUserDoctorMessage")
    Observable<JSONObject> addUserDoctorMessage(@Body UserDoctorMessage userDoctorMessage, @Header("platform") String platform, @Header("version") String version,
                                          @Header("authorization") String authorization
            , @Header("X-Date") String gmtStr, @Header("Content-md5") String contentMD5, @Header("proxy-authorization") String hmacCode
    );

    //获取论坛详细消息
    @GET("/prod-api/android/forum/getInfoForAndroid")
    Observable<JSONObject> getforum(@Query("forumId")Long forumId,@Header("platform") String platform, @Header("version") String version,
                                     @Header("authorization") String authorization
            , @Header("X-Date") String gmtStr, @Header("Content-md5") String contentMD5, @Header("proxy-authorization") String hmacCode
    );

    //获取论坛评论消息
    @GET("/prod-api/android/comment/researchByForumId")
    Observable<JSONObject> getforumComment(@Query("forumId")Long forumId,@Header("platform") String platform, @Header("version") String version,
                                     @Header("authorization") String authorization
            , @Header("X-Date") String gmtStr, @Header("Content-md5") String contentMD5, @Header("proxy-authorization") String hmacCode
    );

    //增加评论消息
    @POST("/prod-api/android/comment/addComment")
    Observable<JSONObject> addComment(@Body Comment comment, @Header("platform") String platform, @Header("version") String version,
                                      @Header("authorization") String authorization
            , @Header("X-Date") String gmtStr, @Header("Content-md5") String contentMD5, @Header("proxy-authorization") String hmacCode
    );

    //获取计划1
    @GET("/prod-api/android/plan/selectByMessageTypeId")
    Observable<JSONObject> getPlan(@Query("messageTypeId")Long messageTypeId,@Header("platform") String platform, @Header("version") String version,
                                    @Header("authorization") String authorization
            , @Header("X-Date") String gmtStr, @Header("Content-md5") String contentMD5, @Header("proxy-authorization") String hmacCode
    );
    //获取计划byid
    @GET("/prod-api/android/plan/getInfoForAndroid")
    Observable<JSONObject> getPlanById(@Query("planId")Long planId,@Header("platform") String platform, @Header("version") String version,
                                   @Header("authorization") String authorization
            , @Header("X-Date") String gmtStr, @Header("Content-md5") String contentMD5, @Header("proxy-authorization") String hmacCode
    );
}
